﻿#ifndef FSPINBOX_H
#define FSPINBOX_H

#include <QSpinBox>

class FSpinBox : public QSpinBox
{
    Q_OBJECT
public:
    explicit FSpinBox(QWidget *parent = nullptr);

protected:
    // 按钮区域
    QRect upRect() const;
    QRect dnRect() const;
    void resetHover();
    void updateHoverState(const QPoint &pos);
    void updatePressState(const QPoint &pos, bool pressed);
    void paintEvent(QPaintEvent *event) override;
    void enterEvent(QEvent *e) override;
    void leaveEvent(QEvent *e) override;
    void mousePressEvent(QMouseEvent *e) override;
    void mouseReleaseEvent(QMouseEvent *e) override;

private:
    bool m_hoverUp = false;
    bool m_hoverDown = false;
    bool m_pressUp = false;
    bool m_pressDown = false;
};

#endif // FSPINBOX_H
